package com.itheima.health.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.common.MessageConst;
import com.itheima.entity.Result;
import com.itheima.health.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
*@Antuor lihenan
*@Date 2020/3/26
*@Version v1.0
*@Description 用户业务控制器
*/
@RestController
@RequestMapping("web/user")
public class UserController {
    //依赖注入service对象
    @Reference
    private UserService userService;
    @RequestMapping("login")
    public Result login(String username,String password){
        System.out.println("health_oms_backend===u"+username);
        //调用service,进行用户信息登录方法

        if ( userService.login(username,password)){
            //正确
            System.out.println("login success");
            return new Result(true, MessageConst.ACTION_SUCCESS);
        }else {
            System.out.println("login fail");
            return new Result(false,MessageConst.ACTION_FAIL);
        }
    }
}
